class PagesController < ApplicationController

  # about action
  def about
    @page_title = "About Us"
  end

  # contact action
  def contact
    @page_title = "Contact Information"
  end

  # GET /time - 专门显示时间信息
  def time
    @page_title = "当前时间"

    # 定义时间变量
    @current_hour = Time.current.hour
    @current_month = Time.current.month
    @current_day = Time.current.day
    @current_year = Time.current.year

    # 定义条件变量
    @is_morning = Time.current.hour < 12
    @is_afternoon = Time.current.hour >= 12 && Time.current.hour < 18
    @is_evening = Time.current.hour >= 18
    @is_weekend = [0, 6].include?(Time.current.wday)

    # 定义循环示例数据
    @seasons = ["春季", "夏季", "秋季", "冬季"]
    @weekdays = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
    @time_periods = [
      { name: "凌晨", range: "00:00-06:00" },
      { name: "上午", range: "06:00-12:00" },
      { name: "下午", range: "12:00-18:00" },
      { name: "晚上", range: "18:00-24:00" }
    ]

  end


end
